close all

data

[h_rect,w] = freqz(fir_coeff_rect,512,44100);

[h_hamm,w] = freqz(fir_coeff_hamm,512,44100);

[h_hann,w] = freqz(fir_coeff_hann,512,44100);

[h_black,w] = freqz(fir_coeff_black,512,44100);
f=w.*44100/(2*pi);

figure('Name',"Ventana")
% Orden de filtro 19
% Frecuencia de corte 5000 Hz
% Tipo Paso bajo
plot(f, 20*log10(abs(h_rect)),'-r',f,20*log10(abs(h_hamm)),'-b',f,20*log10(abs(h_hann)),'-g',f,20*log10(abs(h_black)),'-k');

legend("Rectangular","Hammming","Hanning","blackman");
title("Respuesta del filtro FIR para cada ventana",'FontSize',20)
xlabel("Frecuencia (Hz)",'FontSize',14)
ylabel("Ganancia (dB)",'FontSize',14)
print -deps ventana.eps -color

%~ figure
%~ plot(f, angle(h_rect),'-r',f,angle(h_hamm),'-b',f,angle(h_hann),'-g',f,angle(h_black),'-k');

[h_low29,w] = freqz(fir_coeff_29,512,44100);

[h_low19,w] = freqz(fir_coeff_19,512,44100);

[h_low9,w] = freqz(fir_coeff_9,512,44100);

[h_low3,w] = freqz(fir_coeff_3,512,44100);
f=w.*44100/(2*pi);

figure('Name',"Orden")
% Frecuencia de corte 5000 Hz
% Ventana Blackman
% Tipo Paso bajo
plot(f, 20*log10(abs(h_low3)),'-r',f,20*log10(abs(h_low9)),'-b',f,20*log10(abs(h_low19)),'-g',f,20*log10(abs(h_low29)),'-k');

legend("Orden 3","Orden 9","Orden 19","Orden 29");
title("Respuesta del filtro FIR para cada orden",'FontSize',20)
xlabel("Frecuencia (Hz)",'FontSize',14)
ylabel("Ganancia (dB)",'FontSize',14)
print -deps orden.eps -color

% Orden de filtro 19
% Frecuencia de corte inferior 5000 Hz
% Frecuencia de corte superior 10000 Hz
% Ventana Blackman


[h_low,w] = freqz(fir_coeff_low,512,44100);

[h_high,w] = freqz(fir_coeff_high,512,44100);

[h_band,w] = freqz(fir_coeff_band,512,44100);

[h_stop,w] = freqz(fir_coeff_stop,512,44100);
f=w.*44100/(2*pi);

figure('Name',"Tipo")
plot(f, 20*log10(abs(h_low)),'-r',f,20*log10(abs(h_high)),'-b',f,20*log10(abs(h_band)),'-g',f,20*log10(abs(h_stop)),'-k');

legend("Paso bajo","Paso alto","Pasa banda","Suprime banda");
title("Respuesta del filtro FIR para cada tipo",'FontSize',20)
xlabel("Frecuencia (Hz)",'FontSize',14)
ylabel("Ganancia (dB)",'FontSize',14)
print -deps tipo.eps -color

